package com.neusoft.weekreport.component.bizService.impl;

import com.neusoft.weekreport.component.bizService.ExportWeekToExcelService;
import com.neusoft.weekreport.component.bizService.UserBizService;
import com.neusoft.weekreport.component.entities.*;
import com.neusoft.weekreport.component.req.ExportWeekInfoReq;
import com.neusoft.weekreport.component.req.GetUserInfoReq;
import com.neusoft.weekreport.component.resp.*;
import com.neusoft.weekreport.mapper.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.regex.Pattern;

@Service
public class ExportWeekToExcelServiceImpl implements ExportWeekToExcelService {

    @Resource
    ReWeekDetailMapper reWeekDetailMapper;
    @Resource
    ReWeekSummaryMapper reWeekSummaryMapper;
    @Resource
    BsWeekDetailMapper bsWeekDetailMapper;
    @Resource
    BsWeekSummaryMapper bsWeekSummaryMapper;
    @Resource
    UserBizService userBizService;
    @Resource
    DcWeekMapper dcWeekMapper;
    @Resource
    MsGroupMapper msGroupMapper;
    @Resource
    MsGroupRefUserMapper msGroupRefUserMapper;

    //周报导出
    @Override
    public void exportWeekInfo(ExportWeekInfoReq req, HttpServletResponse response) throws Exception{

        //生成Excel流文件返回给前端
        String weekStr = getMonthWeekStr(req);
        String fileName = "云医疗事业部-" + req.getDepartment().replace("开发部","") + "产品线-研发周报("+ weekStr.replace(" ","")+").xlsx";//文件名称
        response.setContentType("application/vnd.ms-excel;charset = utf-8");//将结果导出为Excel
        response.setHeader("Content-Disposition","attachment;filename=" + new String(fileName.getBytes(),"ISO8859-1"));//将文件作为附件下载
        req.setWeek(weekStr);
        XSSFWorkbook workbook = writeExcelInfo(req);
        workbook.write(response.getOutputStream());
    }

    @Override
    public StringResp getMonthWeek(ExportWeekInfoReq req) throws Exception {
        StringResp stringResp = new StringResp();
        String weekStr = getMonthWeekStr(req);
        String fileName = "云医疗事业部-" + req.getDepartment().replace("开发部","") + "产品线-研发周报("+ weekStr.replace(" ","")+").xlsx";//文件名称
        stringResp.setStr(fileName);
        return stringResp;
    }

    public String getMonthWeekStr(ExportWeekInfoReq req){
        String[] strArr = req.getWeek().split(" ");
        DcWeekExample dcWeekExample = new DcWeekExample();
        DcWeekExample.Criteria criteria = dcWeekExample.createCriteria();
        criteria.andYearEqualTo(req.getYear());
        criteria.andYearWeekEqualTo(strArr[2]);
        List<DcWeek> dcWeekList = dcWeekMapper.selectByExample(dcWeekExample);
        String week = "";
        if(dcWeekList.size()>0){
            week = req.getYear()+"年" +dcWeekList.get(0).getMonth()+"月第" + dcWeekList.get(0).getMonthWeek() + "期";
        }else{
            week = req.getWeek();
        }
        return week;
    }


    public XSSFWorkbook writeExcelInfo(ExportWeekInfoReq req) throws Exception {

        //查询所有用户
        HashSet<String> msUsersHashSet = getUserAll(req.getUserId());
        Integer userNum = msUsersHashSet.size();
        XSSFWorkbook workbook = new XSSFWorkbook();//创建Excel工作簿对象
        XSSFSheet sheet = workbook.createSheet();//在工作簿中创建工作表对象
        sheet.setDisplayGridlines(false);//隐藏Excel网格线,默认值为true
        //设置列宽度
        sheet.setColumnWidth(0,36*256);
        sheet.setColumnWidth(1,15*256);
        sheet.setColumnWidth(2,100*256);
        workbook.setSheetName(0, req.getWeek().replace(" ",""));//设置工作表的名称

        int colNum=0;
        //大标题
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row01 = sheet.createRow(colNum);//创建第1行
        row01.setHeight((short) 700);
        Cell cell_01 = row01.createCell(0);//一行中的第1个单元格
        cell_01.setCellStyle(setStyleBigTitle(workbook));
        cell_01.setCellValue(req.getDepartment().replace("开发部","") + "研发周报"+req.getWeek().replace(" ","") + "（" + processDate(req.getStartDate(),req.getEndDate()) +"）");//给单元格添加内容
        colNum +=1;

        //领导编写概述
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row11 = sheet.createRow(colNum);//创建第1行
        row11.setHeight((short) 1000);
        Cell cell_11 = row11.createCell(0);//一行中的第1个单元格
        cell_11.setCellStyle(setStyleWeekSummaryContent(workbook));
        cell_11.setCellValue("");//给单元格添加内容
        colNum +=1;

        //周报概述标题
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row21 = sheet.createRow(colNum);//创建第1行
        Cell cell_21 = row21.createCell(0);//一行中的第1个单元格
        cell_21.setCellStyle(setStyleSummarytitle(workbook));
        cell_21.setCellValue(req.getDepartment() + "总人数" + userNum+ "人，研发及项目支持人员分布情况如下：");//给单元格添加内容
        colNum +=1;

        //周报概述研发标题
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row31 = sheet.createRow(colNum);//创建第1行
        Cell cell_31 = row31.createCell(0);//一行中的第1个单元格
        cell_31.setCellStyle(setStyleSummarytitle(workbook));
        cell_31.setCellValue("一、产品研发" + getProductPersonCount(req));//给单元格添加内容
        colNum +=1;

        //产品研发概述
        colNum = setWeekProductSummaryExcel( workbook,  sheet,  colNum , getProductSummaryInfo(req));

        //项目概述
        colNum = setWeekProjectSummaryExcel( workbook,  sheet,  colNum , getProjectSummaryInfo(req),req);

        //工作明细
        colNum = setWeekDetailExcel( workbook, sheet,colNum ,getWeekProductInifo(req),"一、本周研发工作");
        colNum = setWeekDetailExcel( workbook, sheet,colNum ,getWeekProjectInfo(req),"二、本周项目支持");
        colNum = setWeekDetailExcel( workbook, sheet,colNum ,getNextWeekProductInfo(req),"三、下周研发计划");
        colNum = setWeekDetailExcel( workbook, sheet,colNum ,getNextWeekProjectInfo(req),"四、下周项目支持");

        return workbook;
    }

    public String processDate(String startDate,String endDate){
        String newStartDate = startDate.substring(5,10).replace("-","月") + "日";
        String newEndDate = endDate.substring(5,10).replace("-","月") + "日";
        return newStartDate + "-" + newEndDate ;
    }

    //循环填充工作明细内容
    public int setWeekDetailExcel(XSSFWorkbook workbook, XSSFSheet sheet, int colNum , List<ExportWeekDetailInfo> productList, String title){

        //标题：本周研发工作
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row01 = sheet.createRow(colNum);//创建第1行
        Cell cell_01 = row01.createCell(0);//一行中的第1个单元格
        cell_01.setCellStyle(setStyleWeekDetailTitle(workbook));
        cell_01.setCellValue(title);//给单元格添加内容
        ++colNum;

        //表头
        Row row02 = sheet.createRow(colNum);
        row02.setHeight((short) (25 * 20));

        Cell cell21 = row02.createCell(0);
        cell21.setCellStyle(setStyleWeekDetailColunm(workbook));
        cell21.setCellValue("任务计划");

        Cell cell22 = row02.createCell(1);
        cell22.setCellStyle(setStyleWeekDetailColunm(workbook));
        cell22.setCellValue("负责人");

        Cell cell23 = row02.createCell(2);
        cell23.setCellStyle(setStyleWeekDetailColunm(workbook));
        cell23.setCellValue("工作内容");
        ++colNum;

        //周报具体信息
        for (ExportWeekDetailInfo exportWeekDetailInfo : productList) {

            Row row03 = sheet.createRow(colNum);
            Cell cell31 = row03.createCell(0);
            cell31.setCellStyle(setStyleWeekDetailContent(workbook));
            cell31.setCellValue(exportWeekDetailInfo.getTaskName());


            Cell cell32 = row03.createCell(1);
            cell32.setCellStyle(setStyleWeekDetailContent(workbook));
            cell32.setCellValue(exportWeekDetailInfo.getUserName());

            Cell celli33 = row03.createCell(2);
            celli33.setCellStyle(setStyleWeekDetailContent(workbook));
            String workContent = filterWorkContent(exportWeekDetailInfo.getWorkContent());
            celli33.setCellValue(workContent);
            ++colNum;
        }

        //空白一行
        sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
        Row row04 = sheet.createRow(colNum);
        Cell cell_41 = row04.createCell(0);//一行中的第1个单元格
        ++colNum;

        return colNum;
    }

    //循环填充产品概述内容
    public int setWeekProductSummaryExcel(XSSFWorkbook workbook, XSSFSheet sheet, int colNum , List<ExportWeekSummaryInfo> productList){

        //产品概述信息
        for (ExportWeekSummaryInfo exportWeekSummaryInfo : productList) {
            sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
            Row row01 = sheet.createRow(colNum);

            float hieght=getExcelCellAutoHeight("      "+exportWeekSummaryInfo.getTaskName() + "：  " + exportWeekSummaryInfo.getWorkContent(), 55f);
            //根据字符串的长度设置高度
            sheet.getRow(sheet.getLastRowNum()).setHeightInPoints(hieght);

            Cell cell01 = row01.createCell(0);
            cell01.setCellStyle(setStyleWeekSummaryContent(workbook));
            cell01.setCellValue("      "+exportWeekSummaryInfo.getTaskName() + "：  " + exportWeekSummaryInfo.getWorkContent());
            ++colNum;
        }

        return colNum;
    }

    //处理字符串首位编号
    public String filterWorkContent(String workContent){
        String newWorkContent = (Pattern.compile(("^[0-9]+[、]|[0-9]+[.]|[0-9]+[\\\\]"),Pattern.MULTILINE)).matcher(workContent).replaceAll("");
        return newWorkContent;
    }

    //处理字符串结尾标点符号
    public String filterWorkDetail(String workDetail){
        String newWorkDetail = (Pattern.compile("[。.、：:!！，,;；\\\\]$")).matcher(workDetail).replaceAll("");
        return newWorkDetail;
    }

    //处理字符串结尾标点符号
    public String filterWorkDetailEnter(String workDetail){
        String newWorkDetail1= (Pattern.compile(("[\\s]$"),Pattern.MULTILINE)).matcher(workDetail).replaceAll("");
        String newWorkDetail = (Pattern.compile(("[。.、：:!！，,;；\\\\]$"),Pattern.MULTILINE)).matcher(newWorkDetail1).replaceAll("");
        return newWorkDetail;
    }

    //循环填充项目概述内容
    public int setWeekProjectSummaryExcel(XSSFWorkbook workbook, XSSFSheet sheet, int colNum , List<ExportWeekSummaryInfo> projectList,ExportWeekInfoReq req){
        for (ExportWeekSummaryInfo exportWeekSummaryInfo : projectList) {
            sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
            Row row01 = sheet.createRow(colNum);
            Cell cell01 = row01.createCell(0);
            cell01.setCellStyle(setStyleSummarytitle(workbook));
            cell01.setCellValue(exportWeekSummaryInfo.getTaskName() + getProjectPersonCount(req,exportWeekSummaryInfo.getTaskId()));
            ++colNum;
            int i=1;
            for (String str : exportWeekSummaryInfo.getWorkContentList()) {
                sheet.addMergedRegion(new CellRangeAddress(colNum, colNum, 0, 2));//合并单元格
                Row row11 = sheet.createRow(colNum);
                Cell cell11 = row11.createCell(0);

                float hieght=getExcelCellAutoHeight("      "+ i +"、"+str, 55f);
                //根据字符串的长度设置高度
                sheet.getRow(sheet.getLastRowNum()).setHeightInPoints(hieght);

                cell11.setCellStyle(setStyleWeekSummaryContent(workbook));
                cell11.setCellValue("      "+ i +"、"+str);
                ++i;
                ++colNum;
            }
        }
        return colNum;
    }

    //设置概述内容样式
    public XSSFCellStyle setStyleWeekSummaryContent(XSSFWorkbook workbook){
        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
        cellStyle.setAlignment(HorizontalAlignment.LEFT);//水平居中
        XSSFFont font = workbook.createFont();//创建字体对象
        font.setFontHeightInPoints((short) 14);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。
        cellStyle.setWrapText(true);
        return cellStyle;
    }

    //设置概述标题样式
    public XSSFCellStyle setStyleSummarytitle(XSSFWorkbook workbook){
        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
        cellStyle.setAlignment(HorizontalAlignment.LEFT);//水平居中
        XSSFFont font = workbook.createFont();//创建字体对象
        XSSFColor xssfColor= new XSSFColor(new java.awt.Color(0, 178,241));
        font.setColor(xssfColor);
        font.setFontHeightInPoints((short) 14);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
//        font.setBold(true);//设置粗体
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。
        cellStyle.setWrapText(true);
        return cellStyle;
    }

    //设置周报大标题样式
    public XSSFCellStyle setStyleBigTitle(XSSFWorkbook workbook){
        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式

        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
        cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中

        XSSFFont font = workbook.createFont();//创建字体对象
        font.setFontHeightInPoints((short) 24);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
        font.setColor(Font.COLOR_NORMAL);
        font.setBold(true);//设置粗体
        XSSFColor xssfColor= new XSSFColor(new java.awt.Color(0, 119,187));
        font.setColor(xssfColor);
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。
        cellStyle.setWrapText(true);
        return cellStyle;
    }

    //设置周报明细标题样式
    public XSSFCellStyle setStyleWeekDetailTitle(XSSFWorkbook workbook){
        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式

        cellStyle.setFillForegroundColor(IndexedColors.BLUE_GREY.getIndex());
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
        XSSFFont font = workbook.createFont();//创建字体对象
        font.setFontHeightInPoints((short) 16);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
        font.setBold(true);//设置粗体
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。

        cellStyle.setWrapText(true);
        return cellStyle;
    }

    //设置周报明细表头样式
    public XSSFCellStyle setStyleWeekDetailColunm(XSSFWorkbook workbook){

        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式

        XSSFColor xssfColor= new XSSFColor(new java.awt.Color(141,180,226));
        cellStyle.setFillForegroundColor(xssfColor);
        cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
        cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中

        cellStyle.setBorderBottom(BorderStyle.THIN); // 下边框
        cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderLeft(BorderStyle.THIN);// 左边框
        cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderTop(BorderStyle.THIN);// 上边框
        cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderRight(BorderStyle.THIN);// 右边框
        cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());

        XSSFFont font = workbook.createFont();//创建字体对象
        font.setFontHeightInPoints((short) 12);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
        font.setBold(true);//设置粗体
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。

        cellStyle.setWrapText(true);
        return cellStyle;
    }

    //设置周报明细内容样式
    public XSSFCellStyle setStyleWeekDetailContent(XSSFWorkbook workbook){
        //设置单元格字体
        XSSFCellStyle cellStyle = workbook.createCellStyle();//用于设置单元格的显示样式
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中

        cellStyle.setBorderBottom(BorderStyle.THIN); // 下边框
        cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderLeft(BorderStyle.THIN);// 左边框
        cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderTop(BorderStyle.THIN);// 上边框
        cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
        cellStyle.setBorderRight(BorderStyle.THIN);// 右边框
        cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());

        XSSFFont font = workbook.createFont();//创建字体对象
        font.setFontHeightInPoints((short) 12);//设置字号大小
        font.setFontName("微软雅黑");//设置字体
        cellStyle.setFont(font);//将字体设置添加到单元格样式中。
        cellStyle.setWrapText(true);
        return cellStyle;
    }

        //递归查询所有组
    public List<String> getALlGroup(List<String> GroupIdList,String groupId){

        MsGroupExample msGroupExample = new MsGroupExample();
        MsGroupExample.Criteria criteria3 = msGroupExample.createCriteria();
        criteria3.andParentIdEqualTo(groupId);
        List<MsGroup> msGroupList = msGroupMapper.selectByExample(msGroupExample);
        if(!CollectionUtils.isEmpty(msGroupList)){
            for (MsGroup msGroup : msGroupList) {
                GroupIdList.add(msGroup.getId());
                getALlGroup(GroupIdList,msGroup.getId());
            }
        }else{
            GroupIdList.add(groupId);
        }
        return GroupIdList;
    }
    //查询本周研发概述并合并
    public List<ExportWeekSummaryInfo> getProductSummaryInfo(ExportWeekInfoReq req){
//        List<String> groupIdList = new ArrayList<>();
//        groupIdList = getALlGroup(groupIdList,req.getGroupIdList().get(0).getId());
//        for (MsGroup msGroup : req.getGroupIdList()) {
//            groupIdList.add(msGroup.getId());
//        }
        List<ReWeekSummary> reWeekSummaryList =reWeekSummaryMapper.selectProductWeekSummary(req.getWeekId(),"1");
        List<ExportWeekSummaryInfo> exportWeekSummaryInfoList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(reWeekSummaryList)){
            int num=1;
            for (ReWeekSummary reWeekSummary : reWeekSummaryList) {
                if(StringUtils.isEmpty(reWeekSummary.getWorkContent())){
                    continue;
                }else{
                    ExportWeekSummaryInfo exportWeekSummaryInfo = new ExportWeekSummaryInfo();
                    String[] reList = reWeekSummary.getWorkContent().split("\n");
                    String workContent = "";
                    for (String reStr : reList) {
                        workContent += filterWorkDetailEnter(reStr) + "；";
                    }
                    if(CollectionUtils.isEmpty(exportWeekSummaryInfoList)){
                        exportWeekSummaryInfo.setTaskId(reWeekSummary.getTaskId());
                        exportWeekSummaryInfo.setTaskName(num +"、"+reWeekSummary.getTaskName());
                        exportWeekSummaryInfo.setWorkContent(workContent);
                        exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
                        ++num;
                    }else{
                        int i=1;
                        for (ExportWeekSummaryInfo weekSummaryInfo : exportWeekSummaryInfoList) {
                            if(weekSummaryInfo.getTaskId().equals(reWeekSummary.getTaskId())){
                                if (!StringUtils.isEmpty(weekSummaryInfo.getWorkContent())) {
                                    weekSummaryInfo.setWorkContent(weekSummaryInfo.getWorkContent() + workContent);
                                }
                                break;
                            }else{
                                if(exportWeekSummaryInfoList.size()==i){
                                    exportWeekSummaryInfo.setTaskId(reWeekSummary.getTaskId());
                                    exportWeekSummaryInfo.setTaskName(num +"、"+reWeekSummary.getTaskName());
                                    exportWeekSummaryInfo.setWorkContent(workContent);
                                    exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
                                    ++num;
                                    break;
                                }else{
                                    i++;
                                }
                            }
                        }
                    }
                }

            }

        }else{
            ExportWeekSummaryInfo exportWeekSummaryInfo = new ExportWeekSummaryInfo();
            exportWeekSummaryInfo.setTaskId("");
            exportWeekSummaryInfo.setTaskName("");
            exportWeekSummaryInfo.setWorkContent("");
            exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
        }
        return exportWeekSummaryInfoList;

    }

    //查询本周项目概述并合并
    public List<ExportWeekSummaryInfo> getProjectSummaryInfo(ExportWeekInfoReq req){
        List<String> groupIdList = new ArrayList<>();
        groupIdList = getALlGroup(groupIdList,req.getGroupIdList().get(0).getId());
        List<ReWeekSummary> reWeekSummaryList =reWeekSummaryMapper.selectProjectWeekSummary(req.getWeekId(),groupIdList,"2");
        List<ExportWeekSummaryInfo> exportWeekSummaryInfoList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(reWeekSummaryList)){
            int num=2;

            for (ReWeekSummary reWeekSummary : reWeekSummaryList) {
                if(StringUtils.isEmpty(reWeekSummary.getWorkContent())){
                    continue;
                }else{
                    String[] reList = reWeekSummary.getWorkContent().split("\n");
                    String workContent = "";
                    for (String reStr : reList) {
                        workContent += filterWorkDetail(reStr) + "；";
                    }
                    if(CollectionUtils.isEmpty(exportWeekSummaryInfoList)){
                        ExportWeekSummaryInfo exportWeekSummaryInfo = new ExportWeekSummaryInfo();
                        List<String> list = new ArrayList<>();
                        exportWeekSummaryInfo.setTaskId(reWeekSummary.getTaskId());
                        exportWeekSummaryInfo.setTaskName(upperNumber(num) + reWeekSummary.getTaskName());
                        list.add(workContent);
                        exportWeekSummaryInfo.setWorkContentList(list);
                        exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
                        ++num;
                    }else{
                        int i=1;
                        for (ExportWeekSummaryInfo exportWeekSummary : exportWeekSummaryInfoList) {
                            if(exportWeekSummary.getTaskId().equals(reWeekSummary.getTaskId())){
                                exportWeekSummary.getWorkContentList().add(workContent);
                                break;
                            }else{
                                if(exportWeekSummaryInfoList.size()==i){
                                    ExportWeekSummaryInfo exportWeekSummaryInfo = new ExportWeekSummaryInfo();
                                    List<String> list = new ArrayList<>();
                                    exportWeekSummaryInfo.setTaskId(reWeekSummary.getTaskId());
                                    exportWeekSummaryInfo.setTaskName(upperNumber(num) + reWeekSummary.getTaskName());
                                    list.add(workContent);
                                    exportWeekSummaryInfo.setWorkContentList(list);
                                    exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
                                    ++num;
                                    break;
                                }else{
                                    ++i;
                                }
                            }
                        }
                    }
                }

            }
        }else{
            ExportWeekSummaryInfo exportWeekSummaryInfo = new ExportWeekSummaryInfo();
            List<String> list = new ArrayList<>();
            exportWeekSummaryInfo.setTaskId("");
            exportWeekSummaryInfo.setTaskName("");
            exportWeekSummaryInfo.setWorkContentList(list);
            exportWeekSummaryInfoList.add(exportWeekSummaryInfo);
        }
        return exportWeekSummaryInfoList;
    }

    //查询投入项目的人数
    public String getProjectPersonCount(ExportWeekInfoReq req,String taskID){
        BsWeekDetailExample bsWeekDetailExample = new BsWeekDetailExample();
        BsWeekDetailExample.Criteria criteria = bsWeekDetailExample.createCriteria();
        criteria.andWeekidEqualTo(req.getWeekId());
        criteria.andTaskIdEqualTo(taskID);
        criteria.andMainPersonIdIn(req.getUserIdList());
        criteria.andTaskTypeEqualTo("2");
        List<BsWeekDetail> bsWeekDetailList = bsWeekDetailMapper.selectByExample(bsWeekDetailExample);
        HashSet<String> userIdList = new HashSet<>();
        for (BsWeekDetail bsWeekDetail : bsWeekDetailList) {
            userIdList.add(bsWeekDetail.getMainPersonId());
        }
        String str = "（" + Integer.toString(userIdList.size()) + "人）";
        return str;
    }
    //查询投入研发的人数:投入的研发人员+禁用的人员
    public String getProductPersonCount(ExportWeekInfoReq req) throws Exception {
        BsWeekDetailExample bsWeekDetailExample = new BsWeekDetailExample();
        BsWeekDetailExample.Criteria criteria = bsWeekDetailExample.createCriteria();
        criteria.andWeekidEqualTo(req.getWeekId());
        criteria.andMainPersonIdIn(req.getUserIdList());
        criteria.andTaskTypeEqualTo("1");
        List<BsWeekDetail> bsWeekDetailList = bsWeekDetailMapper.selectByExample(bsWeekDetailExample);
        HashSet<String> userIdList = new HashSet<>();
        for (BsWeekDetail bsWeekDetail : bsWeekDetailList) {
            userIdList.add(bsWeekDetail.getMainPersonId());
        }
        Integer productNum = userIdList.size();
        //查询禁用用户
        GetUserInfoReq getUserInfoReq = new GetUserInfoReq();
        getUserInfoReq.setId("");
        getUserInfoReq.setUserName("");
        getUserInfoReq.setStateValue(0);
        GetUserInfoListResp resp = userBizService.getUserInfoList(getUserInfoReq);
        Integer noEnableUserNum = resp.getUserInfos().size();

        String str = "（" + Integer.toString(productNum+noEnableUserNum) + "人）";
        return str;
    }

    public String upperNumber(int num){
        String uppNum = "";
        switch (num){
            case 2:
                uppNum="二、";
                break;
            case 3:
                uppNum="三、";
                break;
            case 4:
                uppNum="四、";
                break;
            case 5:
                uppNum="五、";
                break;
            case 6:
                uppNum="六、";
                break;
            case 7:
                uppNum="七、";
                break;
            case 8:
                uppNum="八、";
                break;
            case 9:
                uppNum="九、";
                break;
            case 10:
                uppNum="十、";
                break;
            case 11:
                uppNum="十一、";
                break;
            case 12:
                uppNum="十二、";
                break;
            case 13:
                uppNum="十三、";
                break;
            case 14:
                uppNum="十四、";
                break;
            case 15:
                uppNum="十五、";
                break;
            case 16:
                uppNum="十六、";
                break;
            case 17:
                uppNum="十七、";
                break;
            case 18:
                uppNum="十八、";
                break;
        }
        return uppNum;

    }

    //查询本周研发任务并合并
    public  List<ExportWeekDetailInfo> getWeekProductInifo(ExportWeekInfoReq req){
        List<ReWeekDetail> queryProductWeekList =reWeekDetailMapper.selectProductWeekDetail(req.getWeekId(),req.getUserIdList(),"1");

        List<ExportWeekDetailInfo> productList = new ArrayList();

        if(!CollectionUtils.isEmpty(queryProductWeekList)){
            int num=1;
            for (ReWeekDetail reWeekDetail : queryProductWeekList) {
                ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
                if(CollectionUtils.isEmpty(productList)){
                    List<String> colIdList = new ArrayList<>();
                    colIdList.add(reWeekDetail.getColid());
                    List<String> userIdList = new ArrayList<>();
                    userIdList.add(reWeekDetail.getMainPersonId());
                    exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                    exportWeekDetailInfo.setColIdlist(colIdList);
                    exportWeekDetailInfo.setTaskName(num + "、"+reWeekDetail.getTaskName());
                    exportWeekDetailInfo.setUserIdList(userIdList);
                    exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                    exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                    productList.add(exportWeekDetailInfo);
                    ++num;
                }else{
                    int i=1;
                    for (ExportWeekDetailInfo productLine : productList) {
                        if(productLine.getTaskId().equals(reWeekDetail.getTaskId())){//同一任务
                            if(productLine.getColIdlist().contains(reWeekDetail.getColid())){//同一表格内
                                String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                productLine.setUserName(userName);
                                productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                break;
                            }else{
                                if(productLine.getUserIdList().contains(reWeekDetail.getMainPersonId())){//是否包含此账号
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.setWorkContent(workContent);
                                    break;
                                }else{
                                    String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                    productLine.setUserName(userName);
                                    productLine.setWorkContent(workContent);
                                    break;
                                }
                            }
                        }
                        else{
                            if(productList.size()==i){
                                List<String> colIdList = new ArrayList<>();
                                colIdList.add(reWeekDetail.getColid());
                                List<String> userIdList = new ArrayList<>();
                                userIdList.add(reWeekDetail.getMainPersonId());
                                exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                                exportWeekDetailInfo.setColIdlist(colIdList);
                                exportWeekDetailInfo.setTaskName(num + "、"+ reWeekDetail.getTaskName());
                                exportWeekDetailInfo.setUserIdList(userIdList);
                                exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                                exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                                productList.add(exportWeekDetailInfo);
                                ++num;
                                break;
                            }else{
                                ++i;

                            }

                        }
                    }

                }
            }
        }else{
            ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
            exportWeekDetailInfo.setTaskId("");
            exportWeekDetailInfo.setTaskName("");
            exportWeekDetailInfo.setUserName("");
            exportWeekDetailInfo.setWorkContent("");
            productList.add(exportWeekDetailInfo);
        }
        return productList;

    }

    //查询本周项目支持并合并
    public  List<ExportWeekDetailInfo> getWeekProjectInfo(ExportWeekInfoReq req){

        List<ReWeekDetail> queryProjectWeekList =reWeekDetailMapper.selectProjectWeekDetail(req.getWeekId(),req.getUserIdList(),"2");

        List<ExportWeekDetailInfo> projectList = new ArrayList();

        if(!CollectionUtils.isEmpty(queryProjectWeekList)){
            int num=1;
            for (ReWeekDetail reWeekDetail : queryProjectWeekList) {
                ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
                if(CollectionUtils.isEmpty(projectList)){
                    List<String> colIdList = new ArrayList<>();
                    colIdList.add(reWeekDetail.getColid());
                    List<String> userIdList = new ArrayList<>();
                    userIdList.add(reWeekDetail.getMainPersonId());
                    exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                    exportWeekDetailInfo.setColIdlist(colIdList);
                    exportWeekDetailInfo.setTaskName(num + "、"+reWeekDetail.getTaskName());
                    exportWeekDetailInfo.setUserIdList(userIdList);
                    exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                    exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                    projectList.add(exportWeekDetailInfo);
                    ++num;
                }else{
                    int i=1;
                    for (ExportWeekDetailInfo productLine : projectList) {
                        if(productLine.getTaskId().equals(reWeekDetail.getTaskId())){//同一任务
                            if(productLine.getColIdlist().contains(reWeekDetail.getColid())){//同一表格内
                                String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                productLine.setUserName(userName);
                                productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                break;
                            }else{
                                if(productLine.getUserIdList().contains(reWeekDetail.getMainPersonId())){//是否包含此账号
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.setWorkContent(workContent);
                                    break;
                                }else{
                                    String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                    productLine.setUserName(userName);
                                    productLine.setWorkContent(workContent);
                                    break;
                                }
                            }
                        }
                        else{
                            if(projectList.size()==i){
                                List<String> colIdList = new ArrayList<>();
                                colIdList.add(reWeekDetail.getColid());
                                List<String> userIdList = new ArrayList<>();
                                userIdList.add(reWeekDetail.getMainPersonId());
                                exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                                exportWeekDetailInfo.setColIdlist(colIdList);
                                exportWeekDetailInfo.setTaskName(num + "、"+ reWeekDetail.getTaskName());
                                exportWeekDetailInfo.setUserIdList(userIdList);
                                exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                                exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                                projectList.add(exportWeekDetailInfo);
                                ++num;
                                break;
                            }else{
                                ++i;

                            }

                        }
                    }

                }
            }
        }else{
            ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
            exportWeekDetailInfo.setTaskId("");
            exportWeekDetailInfo.setTaskName("");
            exportWeekDetailInfo.setUserName("");
            exportWeekDetailInfo.setWorkContent("");
            projectList.add(exportWeekDetailInfo);
        }
        return projectList;
    }

    //查询下周研发计划并合并
    public  List<ExportWeekDetailInfo> getNextWeekProductInfo(ExportWeekInfoReq req){
        List<ReWeekDetail> queryNextProductWeekList =reWeekDetailMapper.selectProductWeekDetail(req.getWeekId(),req.getUserIdList(),"3");

        List<ExportWeekDetailInfo> nextProductList = new ArrayList();

        if(!CollectionUtils.isEmpty(queryNextProductWeekList)){
            int num=1;
            for (ReWeekDetail reWeekDetail : queryNextProductWeekList) {
                ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
                if(CollectionUtils.isEmpty(nextProductList)){
                    List<String> colIdList = new ArrayList<>();
                    colIdList.add(reWeekDetail.getColid());
                    List<String> userIdList = new ArrayList<>();
                    userIdList.add(reWeekDetail.getMainPersonId());
                    exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                    exportWeekDetailInfo.setColIdlist(colIdList);
                    exportWeekDetailInfo.setTaskName(num + "、"+reWeekDetail.getTaskName());
                    exportWeekDetailInfo.setUserIdList(userIdList);
                    exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                    exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                    nextProductList.add(exportWeekDetailInfo);
                    ++num;
                }else{
                    int i=1;
                    for (ExportWeekDetailInfo productLine : nextProductList) {
                        if(productLine.getTaskId().equals(reWeekDetail.getTaskId())){//同一任务
                            if(productLine.getColIdlist().contains(reWeekDetail.getColid())){//同一表格内
                                String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                productLine.setUserName(userName);
                                productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                break;
                            }else{
                                if(productLine.getUserIdList().contains(reWeekDetail.getMainPersonId())){//是否包含此账号
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.setWorkContent(workContent);
                                    break;
                                }else{
                                    String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                    productLine.setUserName(userName);
                                    productLine.setWorkContent(workContent);
                                    break;
                                }
                            }
                        }
                        else{
                            if(nextProductList.size()==i){
                                List<String> colIdList = new ArrayList<>();
                                colIdList.add(reWeekDetail.getColid());
                                List<String> userIdList = new ArrayList<>();
                                userIdList.add(reWeekDetail.getMainPersonId());
                                exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                                exportWeekDetailInfo.setColIdlist(colIdList);
                                exportWeekDetailInfo.setTaskName(num + "、"+ reWeekDetail.getTaskName());
                                exportWeekDetailInfo.setUserIdList(userIdList);
                                exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                                exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                                nextProductList.add(exportWeekDetailInfo);
                                ++num;
                                break;
                            }else{
                                ++i;

                            }

                        }
                    }

                }
            }
        }else{
            ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
            exportWeekDetailInfo.setTaskId("");
            exportWeekDetailInfo.setTaskName("");
            exportWeekDetailInfo.setUserName("");
            exportWeekDetailInfo.setWorkContent("");
            nextProductList.add(exportWeekDetailInfo);
        }
        return nextProductList;
    }

    //查询下周项目支持并合并
    public  List<ExportWeekDetailInfo> getNextWeekProjectInfo(ExportWeekInfoReq req){

        List<ReWeekDetail> queryNextProjectWeekList =reWeekDetailMapper.selectProjectWeekDetail(req.getWeekId(),req.getUserIdList(),"4");

        List<ExportWeekDetailInfo>  nextProjectList = new ArrayList();

        if(!CollectionUtils.isEmpty(queryNextProjectWeekList)){
            int num=1;
            for (ReWeekDetail reWeekDetail : queryNextProjectWeekList) {
                ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
                if(CollectionUtils.isEmpty(nextProjectList)){
                    List<String> colIdList = new ArrayList<>();
                    colIdList.add(reWeekDetail.getColid());
                    List<String> userIdList = new ArrayList<>();
                    userIdList.add(reWeekDetail.getMainPersonId());
                    exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                    exportWeekDetailInfo.setColIdlist(colIdList);
                    exportWeekDetailInfo.setTaskName(num + "、"+reWeekDetail.getTaskName());
                    exportWeekDetailInfo.setUserIdList(userIdList);
                    exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                    exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                    nextProjectList.add(exportWeekDetailInfo);
                    ++num;
                }else{
                    int i=1;
                    for (ExportWeekDetailInfo productLine : nextProjectList) {
                        if(productLine.getTaskId().equals(reWeekDetail.getTaskId())){//同一任务
                            if(productLine.getColIdlist().contains(reWeekDetail.getColid())){//同一表格内
                                String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                productLine.setUserName(userName);
                                productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                break;
                            }else{
                                if(productLine.getUserIdList().contains(reWeekDetail.getMainPersonId())){//是否包含此账号
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.setWorkContent(workContent);
                                    break;
                                }else{
                                    String userName= productLine.getUserName() + "\n" +  reWeekDetail.getUserName();
                                    String workContent=productLine.getWorkContent() + "\n" + filterWorkDetailEnter(reWeekDetail.getWorkContent());
                                    productLine.getColIdlist().add(reWeekDetail.getColid());
                                    productLine.getUserIdList().add(reWeekDetail.getMainPersonId());
                                    productLine.setUserName(userName);
                                    productLine.setWorkContent(workContent);
                                    break;
                                }
                            }
                        }
                        else{
                            if(nextProjectList.size()==i){
                                List<String> colIdList = new ArrayList<>();
                                colIdList.add(reWeekDetail.getColid());
                                List<String> userIdList = new ArrayList<>();
                                userIdList.add(reWeekDetail.getMainPersonId());
                                exportWeekDetailInfo.setTaskId(reWeekDetail.getTaskId());
                                exportWeekDetailInfo.setColIdlist(colIdList);
                                exportWeekDetailInfo.setTaskName(num + "、"+ reWeekDetail.getTaskName());
                                exportWeekDetailInfo.setUserIdList(userIdList);
                                exportWeekDetailInfo.setUserName(reWeekDetail.getUserName());
                                exportWeekDetailInfo.setWorkContent(filterWorkDetailEnter(reWeekDetail.getWorkContent()));
                                nextProjectList.add(exportWeekDetailInfo);
                                ++num;
                                break;
                            }else{
                                ++i;

                            }

                        }
                    }

                }
            }
        }else{
            ExportWeekDetailInfo exportWeekDetailInfo = new ExportWeekDetailInfo();
            exportWeekDetailInfo.setTaskId("");
            exportWeekDetailInfo.setTaskName("");
            exportWeekDetailInfo.setUserName("");
            exportWeekDetailInfo.setWorkContent("");
            nextProjectList.add(exportWeekDetailInfo);
        }
        return nextProjectList;

    }


    //计算行高
    public static float getExcelCellAutoHeight(String str, float fontCountInline) {
        float defaultRowHeight = 20.00f;//每一行的高度指定
        float defaultCount = 0.00f;
        for (int i = 0; i < str.length(); i++) {
            float ff = getregex(str.substring(i, i + 1));
            defaultCount = defaultCount + ff;
        }
        return ((int) (defaultCount / fontCountInline) + 1) * defaultRowHeight;//计算
    }

    public static float getregex(String charStr) {

        if(charStr.equals(" "))
        {
            return 0.33f;
        }
        // 判断是否为字母或字符
        if (Pattern.compile("^[A-Za-z0-9]+$").matcher(charStr).matches()) {
            return 0.5f;
        }
        // 判断是否为全角
        if (Pattern.compile("[\u4e00-\u9fa5]+$").matcher(charStr).matches()) {
            return 1.00f;
        }
        //全角符号 及中文
        if (Pattern.compile("[^x00-xff]").matcher(charStr).matches()) {
            return 1.00f;
        }
        return 0.5f;

    }

    public HashSet<String> getUserAll(String userId){
        MsGroupRefUserExample msGroupRefUserExample = new MsGroupRefUserExample();
        MsGroupRefUserExample.Criteria criteria = msGroupRefUserExample.createCriteria();
        criteria.andUseridEqualTo(userId);
        List<MsGroupRefUser> msGroupRefUserList = msGroupRefUserMapper.selectByExample(msGroupRefUserExample);
        List<String> allGroupIdList = new ArrayList<>();
        for (MsGroupRefUser msGroupRefUser : msGroupRefUserList) {
            List<String> groupIdList= new ArrayList<>();
            groupIdList = getGroupId(groupIdList,msGroupRefUser.getGroupid());
            if(groupIdList.size()!=0){
                for (String groupId : groupIdList) {
                    allGroupIdList.add(groupId);
                }
            }
        }
        HashSet hashSet = new HashSet();
        if(allGroupIdList.size()!=0){
            msGroupRefUserExample.clear();
            MsGroupRefUserExample.Criteria criteria1 = msGroupRefUserExample.createCriteria();
            criteria1.andGroupidIn(allGroupIdList);
            List<MsGroupRefUser> msGroupRefUserList1 = msGroupRefUserMapper.selectByExample(msGroupRefUserExample);
            if(msGroupRefUserList1.size()!=0){
                for (MsGroupRefUser msGroupRefUser : msGroupRefUserList1) {
                    hashSet.add(msGroupRefUser.getUserid());
                }
            }
        }
        return hashSet;


    }
    public List<String> getGroupId(List<String> groupIdList,String groupId){
        MsGroupExample msGroupExample = new MsGroupExample();
        MsGroupExample.Criteria criteria = msGroupExample.createCriteria();
        criteria.andParentIdEqualTo(groupId);
        criteria.andWeekFlagEqualTo(1);
        criteria.andEnableEqualTo(1);
        List<MsGroup> msGroupList=msGroupMapper.selectByExample(msGroupExample);
        if(msGroupList.size()!=0){
            for (MsGroup msGroup : msGroupList) {
                groupIdList.add(msGroup.getId());
                getGroupId(groupIdList,msGroup.getId());
            }
        }
        return groupIdList;
    }

}
